import { getiInvoiceDetailList } from '../../api/pay'
Page({
    data: {
        month:'全部',
        id:'',
        hasNextPage:true,
        totalCount:'',
        list:'',
        pageNum:1,
        pageSize:10
    },
    onReady() {
    
    },
    onLoad(option) {
        console.log(option,'option')
        this.setData({
            id:option.id,
            pageNum:this.data.pageNum,
            pageSize:this.data.pageSize
        })
        this.getiInvoiceDetailList()
    },
    getiInvoiceDetailList(){
        getiInvoiceDetailList({
            id:this.data.id,
            pageNum:this.data.pageNum,
            pageSize:this.data.pageSize
        }).then(res=>{
            console.log(res,'res')
            if(!res.hasNextPage){
                this.data.hasNextPage = false
            }
            const arr = []
            arr.push(...this.data.list)
            arr.push(...res.list)
            this.setData({
                list:arr,
            })
        })
    },
    threshold(){
        console.log('到底部啦')
        if(!this.data.hasNextPage){
            return
        }   
        this.data.pageNum += 1
        this.getiInvoiceDetailList()
    }
})